﻿using System;
using System.Web;

namespace netaddICTs.Umb.ProtectedMedia.Business.IO{
    
    public static class FileStorageFactory {
        
        private static readonly Configuration.ProtectedMedia configuration;

        static FileStorageFactory(){
            configuration = Configuration.ProtectedMedia.Instance;
        }
    
        public static IFileStorage GetFileStorageImplementation(){
            
            switch (configuration.Storage.Type) {
                case "VirtualDirectory":
                    return new VirtualDirectoryStorageImpl(HttpContext.Current, configuration.Storage.Path);

                case "LocalFolder":
                    return new LocalFolderStorageImpl(configuration.Storage.Path);

                default:
                    throw new ArgumentException();
            }
        }
    }
}